import React, { Component } from 'react'
import { orderDetail } from '../../api/order';

export default class OrderPay extends Component {
    componentDidMount() {
        const { orderId } = this.props.location.state.data;
        this.timer = setInterval(() => {
            orderDetail(orderId).then(res => {
                if (res.data.result.orderStatus === "01") {
                    clearInterval(this.timer);
                    this.props.history.push('/orderlist');
                }
                else {
                    console.log("支付失败");
                }
            })
        }, 1000)
    }
    render() {
        const { qrcode } = this.props.location.state.data;
        return (
            <div>
                微信二维码支付页面
                <img src={qrcode} alt="微信扫码"></img>
            </div>
        )
    }
}
